Skip to content

Use chained Collect nodes for FLUX.2 reference images graph#130

Open
Copilot wants to merge 4 commits intomainfrom
copilot/modify-invocation-graph-collect-nodes
Open

Use chained Collect nodes for FLUX.2 reference images graph#130
Copilot wants to merge 4 commits intomainfrom
copilot/modify-invocation-graph-collect-nodes

Conversation

Copy link

Copilot AI commented Mar 24, 2026

Summary

When building the FLUX.2 invocation graph, reference images were fed into a single collect node via multiple item edges. Because node execution order isn't guaranteed, the resulting collection order was non-deterministic — causing inconsistent behavior in Flux2RefImageExtension (which uses index-based T-coordinate offsets per image).

Fix: Replace the single collect node with a chain of collect nodes, one per reference image. Each node accumulates the previous collection and appends the next item, guaranteeing insertion order matches the source array order.

Before:

const flux2KontextCollect = g.addNode({ type: 'collect', ... });
for (const { config } of validFlux2RefImageConfigs) {
  const kontextConditioning = g.addNode({ type: 'flux_kontext', ... });
  g.addEdge(kontextConditioning, 'kontext_cond', flux2KontextCollect, 'item');
}
g.addEdge(flux2KontextCollect, 'collection', flux2Denoise, 'kontext_conditioning');

After:

let prevCollect: Invocation<'collect'> | null = null;
for (const { config } of validFlux2RefImageConfigs) {
  const kontextConditioning = g.addNode({ type: 'flux_kontext', ... });
  const collectNode = g.addNode({ type: 'collect', ... });
  g.addEdge(kontextConditioning, 'kontext_cond', collectNode, 'item');
  if (prevCollect !== null) {
    g.addEdge(prevCollect, 'collection', collectNode, 'collection');
  }
  prevCollect = collectNode;
}
assert(prevCollect !== null);
g.addEdge(prevCollect, 'collection', flux2Denoise, 'kontext_conditioning');

Related Issues / Discussions

QA Instructions

With multiple FLUX.2 reference images, verify that generation is stable across repeated runs (same images, same seed → same output).

Merge Plan

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • ❗Changes to a redux slice have a corresponding migration
  • Documentation added / updated (if applicable)
  • Updated What's New copy (if doing a release after this PR)

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI changed the title [WIP] Update invocation graph to use chained Collect nodes Use chained Collect nodes for FLUX.2 reference images graph Mar 24, 2026
Copilot AI requested a review from lstein March 24, 2026 01:50
@lstein lstein marked this pull request as ready for review March 24, 2026 02:40
Copy link
Owner

@lstein lstein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and works as expected with FLUX.2 Edit.

weblate and others added 2 commits March 23, 2026 23:09
* translationBot(ui): update translation (Italian)

Currently translated at 98.0% (2205 of 2250 strings)

Co-authored-by: Riccardo Giovanetti <riccardo.giovanetti@gmail.com>
Translate-URL: https://hosted.weblate.org/projects/invokeai/web-ui/it/
Translation: InvokeAI/Web UI

* translationBot(ui): update translation files

Updated by "Remove blank strings" hook in Weblate.

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/invokeai/web-ui/
Translation: InvokeAI/Web UI

* translationBot(ui): update translation (Italian)

Currently translated at 97.8% (2210 of 2259 strings)

Translation: InvokeAI/Web UI
Translate-URL: https://hosted.weblate.org/projects/invokeai/web-ui/it/

* translationBot(ui): update translation (Italian)

Currently translated at 97.8% (2224 of 2272 strings)

Translation: InvokeAI/Web UI
Translate-URL: https://hosted.weblate.org/projects/invokeai/web-ui/it/

* translationBot(ui): update translation (Italian)

Currently translated at 98.1% (2252 of 2295 strings)

Translation: InvokeAI/Web UI
Translate-URL: https://hosted.weblate.org/projects/invokeai/web-ui/it/

* translationBot(ui): update translation (Italian)

Currently translated at 98.0% (2264 of 2309 strings)

Translation: InvokeAI/Web UI
Translate-URL: https://hosted.weblate.org/projects/invokeai/web-ui/it/

* translationBot(ui): update translation (Russian)

Currently translated at 60.7% (1419 of 2334 strings)

Translation: InvokeAI/Web UI
Translate-URL: https://hosted.weblate.org/projects/invokeai/web-ui/ru/

* translationBot(ui): update translation (Italian)

Currently translated at 98.1% (2290 of 2334 strings)

Translation: InvokeAI/Web UI
Translate-URL: https://hosted.weblate.org/projects/invokeai/web-ui/it/

* translationBot(ui): update translation (Italian)

Currently translated at 97.7% (2319 of 2372 strings)

Translation: InvokeAI/Web UI
Translate-URL: https://hosted.weblate.org/projects/invokeai/web-ui/it/

* translationBot(ui): update translation (Italian)

Currently translated at 97.7% (2327 of 2380 strings)

Translation: InvokeAI/Web UI
Translate-URL: https://hosted.weblate.org/projects/invokeai/web-ui/it/

* translationBot(ui): update translation (Italian)

Currently translated at 97.7% (2328 of 2382 strings)

Translation: InvokeAI/Web UI
Translate-URL: https://hosted.weblate.org/projects/invokeai/web-ui/it/

* translationBot(ui): update translation (Italian)

Currently translated at 97.5% (2370 of 2429 strings)

Translation: InvokeAI/Web UI
Translate-URL: https://hosted.weblate.org/projects/invokeai/web-ui/it/

* translationBot(ui): update translation (Finnish)

Currently translated at 1.5% (37 of 2429 strings)

Translation: InvokeAI/Web UI
Translate-URL: https://hosted.weblate.org/projects/invokeai/web-ui/fi/

* translationBot(ui): update translation (Italian)

Currently translated at 97.5% (2373 of 2433 strings)

Translation: InvokeAI/Web UI
Translate-URL: https://hosted.weblate.org/projects/invokeai/web-ui/it/

* translationBot(ui): update translation (Japanese)

Currently translated at 87.1% (2120 of 2433 strings)

Translation: InvokeAI/Web UI
Translate-URL: https://hosted.weblate.org/projects/invokeai/web-ui/ja/

* translationBot(ui): update translation (Italian)

Currently translated at 97.5% (2374 of 2433 strings)

Translation: InvokeAI/Web UI
Translate-URL: https://hosted.weblate.org/projects/invokeai/web-ui/it/

---------

Co-authored-by: Riccardo Giovanetti <riccardo.giovanetti@gmail.com>
Co-authored-by: DustyShoe <warukeichi@gmail.com>
Co-authored-by: Ilmari Laakkonen <ilmarille@gmail.com>
Co-authored-by: 嶋田豪介 <shimada_gosuke@cyberagent.co.jp>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants